package com.zixuan.sina.utils;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @Classname:OssConstant
 * @program:online_edu
 * @author:ZiXuan
 * @crate:2021-11-28-11-33
 **/

@Component
public class OssConstant implements InitializingBean {
    @Value("${aliyun.oss.accessKeyId}")
    private String accessKeyId;
    @Value("${aliyun.oss.accessKeySecret}")
    private String accessKeySecret;
    @Value("${aliyun.oss.address}")
    private String address;
    @Value("${aliyun.oss.bucketname}")
    private String bucketName;

    public static String ACCESS_KEYID;
    public static String ACCESS_KEYSECRET;
    public static String ADDRESS;
    public static String BUCKET_NAME;
    //实现类InitialBean接口后  当spring扫描到当前bean时  就会执行afterPropertiesSet()方法
    @Override
    public void afterPropertiesSet() throws Exception {
        ACCESS_KEYID=accessKeyId;
        ACCESS_KEYSECRET=accessKeySecret;
        ADDRESS=address;
        BUCKET_NAME=bucketName;
    }
}
